﻿namespace SanalMagaza.Model.ViewModel
{
    public class ProductFilter
    {
        public ProductFilter()
        {
        }

        public ProductFilter(ProductOrder productOrd, string productOrder, string orderDir)
        {
            if (productOrd.ToString() != productOrder)
            {
                ProductOrder = productOrd;
                OrderDir = ViewModel.OrderDir.Asc;
                return;
            }
            ProductOrder = productOrd;
            OrderDir = orderDir.ToLower() == "asc" ? ViewModel.OrderDir.Desc : ViewModel.OrderDir.Asc;
        }

        public string SearchString { get; set; }
        public string Category { get; set; }
        public ProductOrder? ProductOrder { get; set; }
        public OrderDir? OrderDir { get; set; }
    }

    public enum ProductOrder
    {
        Category, Title, Price
    }
    public enum OrderDir
    {
        Asc, Desc
    }
}
